package com.qf.controller;

import com.qf.pojo.BaseResp;
import com.qf.pojo.Redios;
import com.qf.server.RedioService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/redio")
public class MvController {

    @Autowired
    RedioService redioService;

    //展示所有视频
    @RequestMapping("/findAllRedio/{page}/{size}")
    public BaseResp findAllRedio(@PathVariable("page")Integer page , @PathVariable("size")Integer size){
        return redioService.findAllRedio(page,size);
    }
    //点赞数增加
    @RequestMapping("/addgood")
    public BaseResp addgood(@RequestBody Map map){
        return redioService.addgood(Integer.valueOf(map.get("id").toString()));
    }
    //作者查找
    @RequestMapping("/findUserByToId")
    public BaseResp findUserByToId(@RequestBody Map map){
        return redioService.findUserByToId(map);
    }
    //单个分享视频查找
    @RequestMapping("/findMvShareById")
    public BaseResp findMvShareById(@RequestBody Map map){
        return redioService.findMvShareById(map);
    }

    //评论查找
    @RequestMapping("/findcomments")
    public BaseResp findcomments(@RequestBody Map map){
        return redioService.findcomments(Integer.valueOf(map.get("id").toString()));
    }
    //评论增加
    @RequestMapping("/addcomments")
    public BaseResp addcomments(@RequestBody Map map){
        return redioService.addcomments(map);
    }
    //排行榜查询
    @RequestMapping("/findAllRedioByScore")
    public BaseResp findAllRedioByScore(){
        return redioService.findAllRedioByScore();
    }
//新增视频
    @RequestMapping("/addredio")
    public BaseResp addredio(@RequestBody Redios redios , HttpServletRequest request){
        return redioService.addredio(redios,request);
    }
}
